#ifndef _zf_driver_adc_h
#define _zf_driver_adc_h

#include "zf_driver_gpio.h"
#include "zf_common_typedef.h"
#include "zf_driver_pwm.h"

typedef enum
{
#if defined(CH32V20x_D6)||defined(CH32V30x_D8C)
    ADC_IN0_A0=0x0000,    // 0x 0[ADC1] 0[CH00] 00[A0]
    ADC_IN1_A1=0x0101,    // 0x 0[ADC1] 1[CH00] 01[A1]
    ADC_IN2_A2=0x0202,    // 0x 0[ADC1] 2[CH00] 02[A2]
    ADC_IN3_A3=0x0303,    // 0x 0[ADC1] 3[CH00] 03[A3]
    ADC_IN4_A4=0x0404,    // 0x 0[ADC1] 4[CH00] 04[A4]
    ADC_IN5_A5=0x0505,    // 0x 0[ADC1] 5[CH00] 05[A5]
    ADC_IN6_A6=0x0606,    // 0x 0[ADC1] 6[CH00] 06[A6]
    ADC_IN7_A7=0x0707,    // 0x 0[ADC1] 7[CH00] 07[A7]
    ADC_IN8_B0=0x0820,    // 0x 0[ADC1] 8[CH00] 20[B0]
    ADC_IN9_B1=0x0921,    // 0x 0[ADC1] 9[CH00] 21[B1]
#endif
#if defined(CH32V30x_D8C)
    ADC_IN10_C0=0x0A40,    // 0x 0[ADC1] A[CH00] 40[C0]
    ADC_IN11_C1=0x0B41,    // 0x 0[ADC1] B[CH00] 41[C1]
    ADC_IN12_C2=0x0C42,    // 0x 0[ADC1] C[CH00] 42[C2]
    ADC_IN13_C3=0x0D43,    // 0x 0[ADC1] D[CH00] 43[C3]
    ADC_IN14_C4=0x0E44,    // 0x 0[ADC1] E[CH00] 44[C4]
    ADC_IN15_C5=0x0F45,    // 0x 0[ADC1] F[CH00] 45[C5]
#endif
}adc_channel_enum;

extern uint16 adc_val[];

void adc_list_init_all(uint8 priority,pwm_channel_enum pin,uint32 freq,uint8_t ADC_SampleTime);
void adc_list_init(uint32 ExternalTrig,uint8_t ADC_SampleTime);
void adc_list_set_priority(uint8 priority);
void adc_list_wait(uint8 bufId);
#endif
